import service from '@/utils/requestTopo';

export const getDeviceGraphics = () =>
  service({
    url: `/simulation/scene/deviceGraphics/`,
    method: 'get',
  });

export const getComDeviceGraphics = params =>
  service({
    url: `/simulation/scene/deviceGraphics/component/`,
    method: 'get',
    params,
  });

// 获取我的图形列表
export const getMyGraphics = () =>
  service({
    url: `/simulation/scene/myGraph/`,
    method: 'get',
  });

export const editorMyGraphics = (id, data) =>
  service({
    url: `/simulation/scene/myGraph/${id}/`,
    method: 'put',
    data,
  });

/**
 * 删除我的图形
 * @param ids
 * @returns {*}
 */
export const delMyGraphics = (ids) =>
  service({
    url: `/simulation/scene/myGraph/`,
    method: 'delete',
    data: {
        ids
    }
  });
export const uploadMyGraphicsFile = data =>
  service({
    url: `/simulation/system/upload/`,
    method: 'post',
    headers: {
      'Content-Type': 'multipart/form-data',
    },
    data,
  });
export const createMyGraphicsFile = data =>
  service({
    url: `/simulation/scene/myGraph/`,
    method: 'post',
    data,
  });

// 新建拓扑

export const createTopology = () =>
  service({
    url: `/simulation/scene/engineTopology/`,
    method: 'post',
  });
export const updateTopology = (id, data) =>
  service({
    url: `/simulation/scene/engineTopology/${id}/topology/`,
    method: 'post',
    data,
  });
export const getTopology = id =>
  service({
    url: `/simulation/scene/engineTopology/${id}/topology/`,
    method: 'post',
  });
export const getTopologyDetail = id =>
  service({
    url: `/simulation/scene/engineTopology/${id}/`,
    method: 'post',
  });

// 获取引擎列表
export const getEngineTopology = () =>
  service({
    url: `/simulation/scene/engineTopology/`,
    method: 'get',
  });

// 删除拓扑引擎
export const delEngineTopology = id =>
  service({
    url: `/simulation/scene/engineTopology/${id}/`,
    method: 'delete',
  });
// 编辑拓扑引擎
export const editorEngineTopology = (id, data) =>
  service({
    url: `/simulation/scene/engineTopology/${id}/`,
    method: 'put',
    data,
  });

/**
 * 上传visio文件，解析
 * @param id
 * @param data
 * @returns {*}
 */
export const uploadVisioFileApi = (id, data) =>
    service({
        url: `/simulation/scene/engineTopology/${ id }/visio/`,
        method: 'post',
        data
    });

/**
 * 批量导入visio文件
 * @param id
 * @param data
 * @returns {*}
 */
export const uploadVisioFilesApi = (id, data) =>
    service({
        url: `/simulation/scene/engineTopology/visio/import/`,
        method: 'post',
        data
    });

/**
 * 获取所有场景版本
 * @param params
 * @returns {*}
 */
export const getSceneVersionAllApi = params =>
    service({
        url: `/simulation/scene/scene/version/`,
        method: 'get',
        params
    });

/**
 * 批量导出到资源库
 * @param data
 * @returns {*}
 */
export const exportSceneVersionToResourceApi = data =>
    service({
        url: `/simulation/scene/scene/version/batchTransfer/`,
        method: 'post',
        data
    });
